There are not supposed to be any routine immigration checks at the borders between Schengen countries, but for many years that has been more a theory than realtiyreality. Several countries introduced temporary regular immigration checks during the refugee 'crisis' in 2015 and this 'temporarity' is in many places still ongoing. Then came corona and was used as an argument for border checks and now we have the flow of refugees from Ukraine.
Short summary: You are and have never been guaranteed to not be controlled when crossing an intra Schengen border. Many Schengen countries also require by law that you carry valid travel documents with you when you cross their borders even if you come from or leave to another Schengen country.