It's software, everything is possible :) It is fairly straightforward to add compile time information via a simple case class definition. There is still a dynamic type check that json matches the case class, but the spec of the structure of the data is done in one place, not spread out arbitrarily over the query code base.
That part is actually coming: https://github.com/apache/spark/pull/5713
There's one past attempt at making it more type safe by using macros. However, there are a lot of caveats for that to be used in practice. https://github.com/marmbrus/sql-typed